package com.itheima.client;

import com.itheima.service.UserService;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;

/**
 * @author 薛虎
 * @date 2021/1/14 11:03
 * rmi客户端
 */
public class ClientMain {

    public static void main(String[] args) throws RemoteException, NotBoundException, MalformedURLException {

        //客户端远程调用服务,客户端需要依赖服务接口
        UserService userService = (UserService) Naming.lookup("rmi://localhost:8888/UserService");
        String s = userService.sayHello("客户端");
        //userService代理对象
        System.out.println(s);

    }

}
